package com.sxfq.loansupermarket.backsystem.modular.logsf.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.sxfq.loansupermarket.backsystem.core.util.StringUtil;
import com.sxfq.loansupermarket.backsystem.modular.logsf.dao.ApprovalProcessAuditDao;
import com.sxfq.loansupermarket.backsystem.modular.logsf.entity.ApprovalProcessAuditInfo;
import com.sxfq.loansupermarket.backsystem.modular.logsf.entity.SearchApprovalProcessAuditInfo;
import com.sxfq.loansupermarket.backsystem.modular.logsf.service.IApprovalProcessService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
@Transactional
public class ApprovalProcessAuditServiceImpl implements IApprovalProcessService {
    @Autowired
    private ApprovalProcessAuditDao dao;

    @Override
    public List<ApprovalProcessAuditInfo> getList(Page<ApprovalProcessAuditInfo> page, SearchApprovalProcessAuditInfo searchInfo) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("page", page);
        if (StringUtil.isNotEmpty(searchInfo.getOutpatientName())) {
            params.put("outpatientName", searchInfo.getOutpatientName());
        }
        if (StringUtil.isNotEmpty(searchInfo.getStartTime())) {
            params.put("startTime", searchInfo.getStartTime());
        }
        if (StringUtil.isNotEmpty(searchInfo.getEndTime())) {
            params.put("endTime", searchInfo.getEndTime());
        }
        return dao.getList(page, params);
    }
}